# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=hasere
pkgver=1.0
pkgrel=5
groups=('blackarch' 'blackarch-recon' 'blackarch-scanner')
pkgdesc='Discover the vhosts using google and bing.'
arch=('any')
url='https://github.com/galkan/hasere'
license=('custom')
depends=('python2')
optdepends=('nmap: Adds nmap support')
source=("https://github.com/galkan/$pkgname/archive/v$pkgver.tar.gz")
sha512sums=('b57ff3ced4e40ec061e9c6509e1a6dc91c172a74')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's|python$|env python2|' *.py
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/"{data,lib}

  install -Dm 755 "$pkgname.py" "$pkgdir/usr/share/$pkgname"
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  cp -a --no-preserve=ownership data/* "$pkgdir/usr/share/$pkgname/data/"
  cp -a --no-preserve=ownership lib/* "$pkgdir/usr/share/$pkgname/lib/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

